import 'reflect-metadata';
export const createParamsDecorator = (key: string) => {
  return <T>(data?: T) =>
    (target: any, propertyKey: string, parameterIndex: number) => {
      const existingParams = Reflect.getMetadata(`params`, target, propertyKey) || [];
      existingParams[parameterIndex] = { key, parameterIndex, data };
      Reflect.defineMetadata(`params`, existingParams, target, propertyKey);
    };
};

export const Request = createParamsDecorator('request');
export const Req = createParamsDecorator('req');
export const Query = createParamsDecorator('query');
export const Session = createParamsDecorator('session');
export const Params = createParamsDecorator('params');
export const Body = createParamsDecorator('body');
export const Response = createParamsDecorator('response');
export const Res = createParamsDecorator('res');
export const Next = createParamsDecorator('next');
